function animal(inputYear) {
  var resultString;
  if (!isNumber(inputYear)) {
    resultString = "input is not a number";
  } else {
    var remainder = inputYear % 12;
    switch (remainder) {
      case 0:
        resultString = "猴";
        break;
      case 1:
        resultString = "鸡";
        break;
      case 2:
        resultString = "狗";
        break;
      case 3:
        resultString = "猪";
        break;
      case 4:
        resultString = "鼠";
        break;
      case 5:
        resultString = "牛";
        break;
      case 6:
        resultString = "虎";
        break;
      case 7:
        resultString = "兔";
        break;
      case 8:
        resultString = "龙";
        break;
      case 9:
        resultString = "蛇";
        break;
      case 10:
        resultString = "马";
        break;
      case 11:
        resultString = "羊";
        break;
      default:
        resultString = "No symbolic Animal";
    }
  }
  return resultString;
}

function isNumber(input) {
  if (parseInt(input).toString() == "NaN") {
    return false;
  } else {
    return true;
  }
}

let myHandler = function (event, context, callback, logger) {
  var res = new context.HTTPResponse({}, {}, "application/json", "200");
  var year;
  if (event.body) {
    var _body = JSON.parse(event.body);
    year = _body.year;
  } else {
    year = event.year;
  }

  logger.info('year=', year)
  let sx = animal(year)
  logger.info('sx=', sx)
  // 设置响应体
  res.body = {
    "result": sx
  }

  context.callback(res)

};
// module.exports.myHandler = myHandler;
export {myHandler}